/**
 * OPBillContentsTBL.java
 * @author pkendzo
 * Email: pkendzo@msn.com
 * 2010
 */
package lu.med.praxiswahl.wahlumed.model.beans;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author pkendzo
 *
 */
@NamedNativeQueries
/*({
  @NamedNativeQuery(name="findBillsContentByBillNumber",
	       query="SELECT d.OPRECHNUNGS_DETAILS_ID, d.date_dent_heure,"
				    + "d.h, d.med, d.TARIF, d.nbr, d.TARIFE_PREIS, d.med_pres, d.RECHNUNGS_ID FROM praxis.praxis_oprechnungs_details d  join praxis.praxis_optarife c "
				    + "on (d.TARIF = c.CODE and d.RECHNUNGS_ID="
				    + " :bill_number"
				    + ") order by STR_TO_DATE(d.date_dent_heure,'%d.%m.%Y') asc, c.PRIORITAET desc",
	        resultClass = OPBillContentsTBL.class)
})
*/

({
    @NamedNativeQuery(name="findBillsContentByBillNumber",
  	       query="SELECT d.OPRECHNUNGS_DETAILS_ID, d.date_dent_heure,"
  				    + "d.h, d.med, d.TARIF, d.anzahl, d.TARIFE_PREIS, d.med_pres, d.RECHNUNGS_ID, d.ABRECHNUNGSCODE FROM praxis.praxis_oprechnungs_details d  " +
  				    "where d.RECHNUNGS_ID="
  				    + " :bill_number"
  				    + " order by STR_TO_DATE(d.date_dent_heure,'%d.%m.%Y') asc",
  	        resultClass = OPBillContentsTBL.class)
  })

/*@NamedNativeQuery(name = "nativeSQL", query = "SELECT emp1.emp_id, emp1.name, emp1.manager_id, "
    + "emp1.dept_id, emp1.address_id " + "FROM EMP emp1, EMP emp2 "
    + "WHERE ((emp2.EMP_ID = ?) AND (emp2.EMP_ID = emp1.MANAGER_ID))", resultClass = Professor.class)
    */

@Entity
@Table(name = "PRAXIS_OPRECHNUNGS_DETAILS")
public class OPBillContentsTBL implements Serializable
{

    /**
     * 
     */
    private static final long serialVersionUID = 4286155296404360797L;


    @Id
    @Column(name = "OPRECHNUNGS_DETAILS_ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long opbillsContentsID;

    
    private String h;
    
    private String date_dent_heure;
    
    private String med;
    
    /*
     * Price of the code rate after the multiplikation
     * with the settlement factor
     */
    @Column(name = "TARIFE_PREIS", nullable = true)
    private double montant;
    
    private String med_pres;
    
    private int anzahl;
    
    @OneToOne
    @JoinColumn(name = "ABRECHNUNGSCODE")
    private OPSettlementTBL settlement_code;
    
    @OneToOne
    @JoinColumn(name = "TARIF")
    private OPCodeRateTBL code_rate;
    
    @ManyToOne
    @JoinColumn(name = "RECHNUNGS_ID")
    private OPBillsTBL rechnungs_nummer;
    
    
    /**
     * 
     */
    public OPBillContentsTBL()
    {
	// TODO Auto-generated constructor stub
    }


    /**
     * @return the opbillsContentsID
     */
    public long getOpbillsContentsID()
    {
        return opbillsContentsID;
    }


    /**
     * @param opbillsContentsID the opbillsContentsID to set
     */
    public void setOpbillsContentsID(long opbillsContentsID)
    {
        this.opbillsContentsID = opbillsContentsID;
    }


    /**
     * @return the h
     */
    public String getH()
    {
        return h;
    }


    /**
     * @param h the h to set
     */
    public void setH(String h)
    {
        this.h = h;
    }


    /**
     * @return the date_dent_heure
     */
    public String getDate_dent_heure()
    {
        return date_dent_heure;
    }


    /**
     * @param date_dent_heure the date_dent_heure to set
     */
    public void setDate_dent_heure(String date_dent_heure)
    {
        this.date_dent_heure = date_dent_heure;
    }


    /**
     * @return the med
     */
    public String getMed()
    {
        return med;
    }


    /**
     * @param med the med to set
     */
    public void setMed(String med)
    {
        this.med = med;
    }


    /**
     * @return the montant
     */
    public double getMontant()
    {
        return montant;
    }


    /**
     * @param montant the montant to set
     */
    public void setMontant(double montant)
    {
        this.montant = montant;
    }


    /**
     * @return the med_pres
     */
    public String getMed_pres()
    {
        return med_pres;
    }


    /**
     * @param med_pres the med_pres to set
     */
    public void setMed_pres(String med_pres)
    {
        this.med_pres = med_pres;
    }


    /**
     * @return the anzahl
     */
    public int getAnzahl()
    {
        return anzahl;
    }


    /**
     * @param anzahl the anzahl to set
     */
    public void setAnzahl(int anzahl)
    {
        this.anzahl = anzahl;
    }


    /**
     * @return the settlement_code
     */
    public OPSettlementTBL getSettlement_code()
    {
        return settlement_code;
    }


    /**
     * @param settlement_code the settlement_code to set
     */
    public void setSettlement_code(OPSettlementTBL settlement_code)
    {
        this.settlement_code = settlement_code;
    }


    /**
     * @return the code_rate
     */
    public OPCodeRateTBL getCode_rate()
    {
        return code_rate;
    }


    /**
     * @param code_rate the code_rate to set
     */
    public void setCode_rate(OPCodeRateTBL code_rate)
    {
        this.code_rate = code_rate;
    }


    /**
     * @return the rechnungs_nummer
     */
    public OPBillsTBL getRechnungs_nummer()
    {
        return rechnungs_nummer;
    }


    /**
     * @param rechnungs_nummer the rechnungs_nummer to set
     */
    public void setRechnungs_nummer(OPBillsTBL rechnungs_nummer)
    {
        this.rechnungs_nummer = rechnungs_nummer;
    }

    
}
